﻿using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;

namespace ZOIL.DataModel
{
    /// <summary>
    /// Contains a list
    /// 
    /// This is used for <see cref="XmlSerializer"/>: No Setter Methods are colled for Collection-Properties
    /// </summary>
    public class CustomList<T>
    {
        public List<T> Items { get; set; } 
    }

    public static class CustomListExtensions
    {
        public static CustomList<T> ToCustomList<T>(this IEnumerable<T> items)
        {
            return new CustomList<T> {Items = items.ToList()};
        }

        public static List<T> ToList<T>(this CustomList<T> customList)
        {
            return customList.Items;
        } 
    }
}